<?php

class Ext_Url_User
{
    public $default;
    
    public function __construct($userId)
    {
        $this->_build($userId);
    }

    private function _build($userId)
    {
        $userOne = App_Model_DbTable_User::getInstance()->getRowById($userId);
        if(!$userOne)
        {
            return "";
        }
        $domain = $userOne['domain'];
        
        $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
        $bootstrap->bootstrap('view');
        $view = $bootstrap->getResource('view');
        
        if($domain){
            $this->default = $view->url(array('domain'=>$domain), "blogDomainFirst", true);
            //$this->default// = "http://".$_SERVER['HTTP_HOST'].$view->baseUrl("blog/domain/").$domain;
        }else{
            //$this->default = "http://".$_SERVER['HTTP_HOST'].$view->baseUrl("blog/userId/").$userId;
            $this->default = $view->url(array('userId'=>$userId), "blogUserId", true);
        }
    }

}